
Data and source codes for
Delbo, Walsh, Bolin, Avdellidou, Morbidelli. 2017.
"Identification of a primordial asteroid family constrains the original planetesimal population"
a paper submitted to Science.

This work is based on our analyis of the inner part of the Main asteroid Belt performed with
the best and fastest database of asteroid physycal properties ever created :) :)
This awesome database is provided here.

====================================================================================================
BUILDING THE CODES
====================================================================================================
The analysis requires bulding a number of utility codes. We wrote them using C++ and python.
To Build them
g++ -std=c++11 bin2ascii.cpp -o bin2ascii 
g++ -std=c++11 mergeAstData.cpp -o mergeAstData
g++ -std=c++11 vshape.cpp -o spotobins
g++ -std=c++11 histo.cpp -o histo
g++ -std=c++11 genOnSlope.cpp -o genOnSlope
g++ -std=c++11 vshape.cpp -o vshape
gcc hclusterMDB.c -o hclusterMDB
chmod +x hcmFam

====================================================================================================
BUILDING THE DATABASE
====================================================================================================
To build the database run the command
$ ./mergeAstData
This code create the ast.bin database and this operation will take a while. Be patient. 

====================================================================================================
READING and USING THE DATABASE
====================================================================================================
bin2ascii is the main tool to read the database and obatain ASCII output from it. The codes
output the data on the unix/macOS/cygwin console. The format of the output is based on columns
and it can be controlled as explained further below. (see -o argument). 

bin2ascii output is controlled via command-line arguments, which typically come with an agrument
followed by two values. The argument select the parameters and the values a range.
Only all asteroids that have a parameter value within the range ar output. If none of the
argument is specified, bin2ascii print the entire databse on the console. 
-a <min> <max>  output all asteroids with proper semimajor axis in the selected range
-i <min> <max>  output all asteroids with proper sin of inclination in the selected range
-e <min> <max>  output all asteroids with proper eccentricity in the selected range
-q <min> <max>  output all asteroids with osculating perihelion distance in the selected range
-Q <min> <max>  output all asteroids with osculating aphelion distance in the selected range
-p <min> <max>  output all asteroids with geometric visible albedo in the range.
   	 	Note that -1=unknown albedo
-D <min> <max>  output all asteroids with diameter in km within the range.
-H <min> <max>  output all asteroids with and H (absolute magnitude) within the range.
-n <min> <max>  output all asteroids with an IAU number within the range.
-f <min> <max>  output all asteroids that belongs to families whose number is in the range
   	 	For instance ./bin2ascii -f 2 3 will print all asteroids of the (2) Pallas family
		but
		 ./bin2ascii -f 2 5 will print all asteroids of the (2) Pallas AND of (3) Juno
		and of the (4) Vesta familes.
		Also ./bin2ascii -f 0 1 will print all asteroids that do not belong to
		families, while ./bin2ascii -f 1 1e6 will print those only asteroids that are
		member of some familes.
   =============SOME other arguments do not require two values:=====================================
-T tax1,tax2,.. output all asteroids that have the tax1 OR tax2 etc etc spectral classes.
   		For instance ./bin2ascii -T S,Sa,Sq,Sr,Sv output all asteroids of the S-complex
		No spaces between classes are allowed. Classes are comma separated values.
-t tax1,tax2,.. output all asteroids that DO NOT have the tax1 OR tax2 etc etc spectral classes.
-o <mode>  	controls the type of output format
   		0: classical output with:
		   Number, designation, H, G, proper a, proper e,
		   proper sin i, D (km), D uncertanty (km), pV, pV uncertanty,
		   Rotation period (h), Taxonomy String, family, a*, i-z
		1: print data of Cibulkova et al. 2016A&A...596A..57C (arXiv:1610.02790)
		   Number, designation, H, G, proper a, proper e,
		   proper sin i, D (km), D uncertanty (km), pV, pV uncertanty,
		   Rotation period (h), hasWISEObsevation= 0/1, Taxonomy String, family, a*, i-z
	           lambda_Cibulkova, beta_Cibulkova, a_bCibulkova, eta);
		2: check the source -- asteroidwithpole.cpp -- method print(int mode)
		3: Thermal inertia (Gamma):
	     	   Number, designation, H, G, proper a, proper e,
		   proper sin i, D (km), D uncertanty (km), pV, pV uncertanty,
		   Rotation period (h), Taxonomy String, family,
	     	   a*, i-z, Gamma;
		4: Data S1 format:
	     	   Number, designation, H, G, proper a, proper e,
		   proper sin i, D (km), D uncertanty (km), pV, pV uncertanty,
		   Rotation period (h), Taxonomy String, family,
	     	   a*, i-z, primFam;
		       The parameter primFam indicate membership of the primordial family.
		       This column can have three integer values 0,1,2,3
    		       0: for non-members.
		       1: for certain. For those objects in the section of space between the inward
		          border of the primitive family V-shape and that of Polana and with D<50 km
		       2: for possible. For those objects in the section of space between the
		          inward border of the primitive family V-shape and that of Polana and
			  with D>= 50 km. These bodies could also be planetesimals. 
		       3: for overlapping. This is  those objects in the section beyond the
		          inward border to the V-shape of Polana that do not belong to currently
			  known families. We used our custom family identification. 

========= PLOTS ====================================================================================
Plots are created mostly using gnuplot under python under MAC OS and Linux
====================== MAIN FIGURES 1-4 ============================================================
to create Fig1 run:
$ gnuplot inverseDaFigure.gnuplot
$ ln -s inverseDaNew.pdf Fig1.pdf

to create Fig2 run:
$ gnuplot bestFigureEverRev1.gnuplot 
$ ln -s bestFigureEverRev1.pdf Fig2.pdf

to create Fig3 run:
$ gnuplot lopSFDorbitRev1_1.gnuplot 
$ ln -s lopSFDorbits.pdf Fig3.pdf

to create Fig4 and Figure S7
$ gnuplot planetSizeDist.gnuplot 
$ ln -s planetSizeD10Gy.pdf Fig4.pdf

====================== SUPPLEMENTARY FIGURES S1-S7 =================================================
** to create Figure S1 (albedoDistributionRev1.pdf) and
and Figure S4 (albedoDistributionLOPs.pdf)
$ gnuplot albedoDistributionRev1.gnuplot

** to create Figure S2 (FigureS2_R2)
$ gnuplot figureS2_R2.gnuplot 

** to create Figure S3 (spotoBins.pdf)
$ gnuplot spotobins.gnuplot

** to create Figure S5 (spectra.pdf)
$ cd spectra/LOP_spectra/allspectra
$ python2.7 interpol.py
this will create the file lops_spectra.pdf which is Fig.S5.A panel
$ cd spectra/ROP_spectra/allspectra
$ python2.7 interpol.py
this will create the file rops_spectra.pdf which is Fig.S5.B panel
LOPs stands for Left Of Polana asteroids
and
ROPs for Right Of Polana asteroids. 

** the method to create Fig S6 is described in the section
DynamicalEvolution

** Figure S7 is generated by the command
$ gnuplot planetSizeDist.gnuplot
which also create Figure 4 of the main paper.

====================== HCM families ================================================================
For the indetification of members of known familes use
./hcmFam <asteroid_number>
e.g.
./hcmFam 163
this will produce for each family a lists of objects with
cutoff velocities ranging from 1 to 250 m/s. This process uses the
code hclusterMBD which is a modified version of the hcluster.c code
from David Nesvorny, publicly avalible at
https://www.boulder.swri.edu/~davidn/family/hcluster.c

====================== Dynamical Evolution =========================================================

In the directory dynevol, we provide the file swift_rmvs3_da.f and a
series of input files to this code. 
swift_rmvs3_da.f is a fortran code that includes a drift in semimajor axis for each simulation test
particle depending on the rate that is entered in the command line.
It is nearly identical to the nominal SWIFT package swift_rmvs3.f with the exception of an
additional call_da subroutine. This code could be compiled and run with an existing SWIFT fortran
package, or easily converted to C to compile and run with the publicly available SWIFTER package.
http://www.boulder.swri.edu/swifter/

The runtime behavior is identical to swift_rmvs3, where the code will ask for a param.in file,
a pl.in file and a tp.in file (files used in some of the siomulations for Delbo et al. 2017) are
included. This version of the code then requires the drift rates to be entered in AU/yr units
in order for each of the test particles in tp.in


====================================================================================================
DATAVERSE DESCRIPTION
====================================================================================================

Asteroid database and related analysis tools and codes

A 4 Gy-old asteroid family and the big asteroid void of the Main Belt

This data set contains a zip file that includes all relevant source codes and ancillary files. Several asteroid physical property data are included here. They have been obtained from the original publications (e.g. Masiero et al. 2011. ApJ 741 68). References to these original publications can be found in the publication related to this dataverse: Delbo, Walsh, Bolin, Avdellidou, Morbidelli. 2017. "Identification of a primordial asteroid family constrains the original planetesimal population", Science, submitted.
